<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../../../">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>pyokx.test.TradeTest &mdash; AntBot 0.0.1 documentation</title>
      <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=80d5e7a1" />
      <link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=19f00094" />
      <link rel="stylesheet" type="text/css" href="../../../_static/graphviz.css?v=eafc0fe6" />

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="../../../_static/jquery.js?v=5d32c60e"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
        <script src="../../../_static/doctools.js?v=888ff710"></script>
        <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../../../_static/js/theme.js"></script>
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="../../../index.html" class="icon icon-home">
            AntBot
          </a>
              <div class="version">
                0.0.1
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../autodocumentation_python.html">autodocumentation_python</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../firebase_tools.BaseClasses.html">firebase_tools.BaseClasses</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../firebase_tools.FirestoreClient.html">firebase_tools.FirestoreClient</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../firebase_tools.authenticate.html">firebase_tools.authenticate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.dashboard.html">h2o_dashboard.dashboard</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.pages.documentation_page.html">h2o_dashboard.pages.documentation_page</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.pages.okx_dashbaord_page.okx_antbot_okx_premium_indicator_handler.html">h2o_dashboard.pages.okx_dashbaord_page.okx_antbot_okx_premium_indicator_handler</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.pages.okx_dashbaord_page.okx_dashboard_page.html">h2o_dashboard.pages.okx_dashbaord_page.okx_dashboard_page</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.pages.okx_streams.html">h2o_dashboard.pages.okx_streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.pages.overview_page.html">h2o_dashboard.pages.overview_page</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.util.html">h2o_dashboard.util</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../h2o_dashboard.wave_auth.html">h2o_dashboard.wave_auth</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.Futures_Exchange_Client.html">pyokx.Futures_Exchange_Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.InstrumentSearcher.html">pyokx.InstrumentSearcher</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.data_structures.html">pyokx.data_structures</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.Account.html">pyokx.low_rest_api.Account</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.BlockTrading.html">pyokx.low_rest_api.BlockTrading</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.Convert.html">pyokx.low_rest_api.Convert</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.CopyTrading.html">pyokx.low_rest_api.CopyTrading</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.Earning.html">pyokx.low_rest_api.Earning</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.FDBroker.html">pyokx.low_rest_api.FDBroker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.Funding.html">pyokx.low_rest_api.Funding</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.Grid.html">pyokx.low_rest_api.Grid</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.MarketData.html">pyokx.low_rest_api.MarketData</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.NDBroker.html">pyokx.low_rest_api.NDBroker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.PublicData.html">pyokx.low_rest_api.PublicData</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.SpreadTrading.html">pyokx.low_rest_api.SpreadTrading</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.Status.html">pyokx.low_rest_api.Status</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.SubAccount.html">pyokx.low_rest_api.SubAccount</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.Trade.html">pyokx.low_rest_api.Trade</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.TradingData.html">pyokx.low_rest_api.TradingData</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.client.html">pyokx.low_rest_api.client</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.consts.html">pyokx.low_rest_api.consts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.exceptions.html">pyokx.low_rest_api.exceptions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.low_rest_api.utils.html">pyokx.low_rest_api.utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.market_data_service.WssMarketDataService.html">pyokx.okx_market_maker.market_data_service.WssMarketDataService</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.market_data_service.model.Instrument.html">pyokx.okx_market_maker.market_data_service.model.Instrument</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.market_data_service.model.MarkPx.html">pyokx.okx_market_maker.market_data_service.model.MarkPx</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.market_data_service.model.OrderBook.html">pyokx.okx_market_maker.market_data_service.model.OrderBook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.market_data_service.model.Tickers.html">pyokx.okx_market_maker.market_data_service.model.Tickers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.order_management_service.WssOrderManagementService.html">pyokx.okx_market_maker.order_management_service.WssOrderManagementService</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.order_management_service.model.Order.html">pyokx.okx_market_maker.order_management_service.model.Order</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.order_management_service.model.OrderRequest.html">pyokx.okx_market_maker.order_management_service.model.OrderRequest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.position_management_service.WssPositionManagementService.html">pyokx.okx_market_maker.position_management_service.WssPositionManagementService</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.position_management_service.model.Account.html">pyokx.okx_market_maker.position_management_service.model.Account</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.position_management_service.model.BalanceAndPosition.html">pyokx.okx_market_maker.position_management_service.model.BalanceAndPosition</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.position_management_service.model.Positions.html">pyokx.okx_market_maker.position_management_service.model.Positions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.run_sample_market_maker.html">pyokx.okx_market_maker.run_sample_market_maker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.settings.html">pyokx.okx_market_maker.settings</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.strategy.BaseStrategy.html">pyokx.okx_market_maker.strategy.BaseStrategy</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.strategy.SampleMM.html">pyokx.okx_market_maker.strategy.SampleMM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.strategy.model.StrategyMeasurement.html">pyokx.okx_market_maker.strategy.model.StrategyMeasurement</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.strategy.model.StrategyOrder.html">pyokx.okx_market_maker.strategy.model.StrategyOrder</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.strategy.params.ParamsLoader.html">pyokx.okx_market_maker.strategy.params.ParamsLoader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.strategy.risk.RiskCalculator.html">pyokx.okx_market_maker.strategy.risk.RiskCalculator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.strategy.risk.RiskSnapshot.html">pyokx.okx_market_maker.strategy.risk.RiskSnapshot</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.tests.test_strategy.html">pyokx.okx_market_maker.tests.test_strategy</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.utils.InstrumentUtil.html">pyokx.okx_market_maker.utils.InstrumentUtil</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.utils.OkxEnum.html">pyokx.okx_market_maker.utils.OkxEnum</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.utils.TdModeUtil.html">pyokx.okx_market_maker.utils.TdModeUtil</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.okx_market_maker.utils.WsOrderUtil.html">pyokx.okx_market_maker.utils.WsOrderUtil</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.redis_structured_reports.html">pyokx.redis_structured_reports</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.redis_structured_streams.html">pyokx.redis_structured_streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.rest_handling.html">pyokx.rest_handling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.rest_messages_service.html">pyokx.rest_messages_service</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.strategy_handling.html">pyokx.strategy_handling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.AccountTest.html">pyokx.test.AccountTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.BlockTradingTest.html">pyokx.test.BlockTradingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.BrokerTest.html">pyokx.test.BrokerTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.ConvertTest.html">pyokx.test.ConvertTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.CopyTradingTest.html">pyokx.test.CopyTradingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.EarningTest.html">pyokx.test.EarningTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.FundingTest.html">pyokx.test.FundingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.GridTest.html">pyokx.test.GridTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.MarketTest.html">pyokx.test.MarketTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.PublicDataTest.html">pyokx.test.PublicDataTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.SpreadTest.html">pyokx.test.SpreadTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.StackingTest.html">pyokx.test.StackingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.SubAccountTest.html">pyokx.test.SubAccountTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.TradeTest.html">pyokx.test.TradeTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.TradingDataTest.html">pyokx.test.TradingDataTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.WsPrivateAsyncTest.html">pyokx.test.WsPrivateAsyncTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.test.WsPublicAsyncTest.html">pyokx.test.WsPublicAsyncTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.websocket_handling.html">pyokx.websocket_handling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.ws_clients.WebSocketFactory.html">pyokx.ws_clients.WebSocketFactory</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.ws_clients.WsPprivateAsync.html">pyokx.ws_clients.WsPprivateAsync</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.ws_clients.WsPublicAsync.html">pyokx.ws_clients.WsPublicAsync</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.ws_clients.WsUtils.html">pyokx.ws_clients.WsUtils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pyokx.ws_data_structures.html">pyokx.ws_data_structures</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../redis_tools.config.html">redis_tools.config</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../redis_tools.consumers.html">redis_tools.consumers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../redis_tools.utils.html">redis_tools.utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rest_app.html">rest_app</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../routers.api_keys.html">routers.api_keys</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../routers.login.html">routers.login</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../routers.okx.html">routers.okx</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../routers.okx_authentication.html">routers.okx_authentication</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../routers.signup.html">routers.signup</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.command_execution.html">shared.command_execution</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.config.html">shared.config</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.configuration_parser.html">shared.configuration_parser</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.data_processing_utils.html">shared.data_processing_utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.file_directory_ops.html">shared.file_directory_ops</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.logging.html">shared.logging</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.string_dict_utils.html">shared.string_dict_utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../shared.tmp_shared.html">shared.tmp_shared</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../tradingview_tools.tradingview_widgets.html">tradingview_tools.tradingview_widgets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../websocket_app.html">websocket_app</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../index.html">AntBot</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../index.html">Module code</a></li>
      <li class="breadcrumb-item active">pyokx.test.TradeTest</li>
      <li class="wy-breadcrumbs-aside">
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <h1>Source code for pyokx.test.TradeTest</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">unittest</span>
<span class="kn">from</span> <span class="nn">pyokx.low_rest_api</span> <span class="kn">import</span> <span class="n">Trade</span>
<div class="viewcode-block" id="TradeTest">
<a class="viewcode-back" href="../../../pyokx.test.TradeTest.html#pyokx.test.TradeTest.TradeTest">[docs]</a>
<span class="k">class</span> <span class="nc">TradeTest</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
<div class="viewcode-block" id="TradeTest.setUp">
<a class="viewcode-back" href="../../../pyokx.test.TradeTest.html#pyokx.test.TradeTest.TradeTest.setUp">[docs]</a>
    <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">api_key</span> <span class="o">=</span> <span class="s1">&#39;your_apiKey&#39;</span>
        <span class="n">api_secret_key</span> <span class="o">=</span> <span class="s1">&#39;your_secretKey&#39;</span>
        <span class="n">passphrase</span> <span class="o">=</span> <span class="s1">&#39;your_secretKey&#39;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">tradeApi</span> <span class="o">=</span> <span class="n">Trade</span><span class="o">.</span><span class="n">TradeAPI</span><span class="p">(</span><span class="n">api_key</span><span class="p">,</span> <span class="n">api_secret_key</span><span class="p">,</span> <span class="n">passphrase</span><span class="p">,</span> <span class="kc">False</span><span class="p">,</span> <span class="s1">&#39;1&#39;</span><span class="p">)</span></div>

<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    def test_place_order(self):</span>
<span class="sd">        print(self.tradeApi.place_order(&quot;BTC-USDT&quot;,tdMode=&quot;cross&quot;,clOrdId=&quot;asCai1&quot;,side=&quot;buy&quot;,ordType=&quot;limit&quot;,sz=&quot;0.01&quot;,px=&quot;18000&quot;))</span>
<span class="sd">    def test_cancel_order(self):</span>
<span class="sd">        print(self.tradeApi.cancel_order(instId=&quot;ETH-USDT&quot;,ordId=&quot;480702180748558336&quot;))</span>

<span class="sd">    def test_batch_order(self):</span>
<span class="sd">        orderData = [    {</span>
<span class="sd">        &quot;instId&quot;:&quot;ETH-USDT&quot;,</span>
<span class="sd">        &quot;tdMode&quot;:&quot;cross&quot;,</span>
<span class="sd">        &quot;clOrdId&quot;:&quot;b151121&quot;,</span>
<span class="sd">        &quot;side&quot;:&quot;buy&quot;,</span>
<span class="sd">        &quot;ordType&quot;:&quot;limit&quot;,</span>
<span class="sd">        &quot;px&quot;:&quot;2.15&quot;,</span>
<span class="sd">        &quot;sz&quot;:&quot;2&quot;</span>
<span class="sd">    },</span>
<span class="sd">    {</span>
<span class="sd">        &quot;instId&quot;:&quot;BTC-USDT&quot;,</span>
<span class="sd">        &quot;tdMode&quot;:&quot;cross&quot;,</span>
<span class="sd">        &quot;clOrdId&quot;:&quot;b152233&quot;,</span>
<span class="sd">        &quot;side&quot;:&quot;buy&quot;,</span>
<span class="sd">        &quot;ordType&quot;:&quot;limit&quot;,</span>
<span class="sd">        &quot;px&quot;:&quot;2.15&quot;,</span>
<span class="sd">        &quot;sz&quot;:&quot;2&quot;</span>
<span class="sd">    }]</span>
<span class="sd">        print(self.tradeApi.place_multiple_orders(orderData))</span>
<span class="sd">    #480702180748558336</span>
<span class="sd">    def test_cancel_batch_orders(self):</span>
<span class="sd">        data=[</span>
<span class="sd">            {</span>
<span class="sd">                &#39;instId&#39;:&quot;ETH-USDT&quot;,</span>
<span class="sd">                &#39;ordId&#39;:&quot;480702885353881600&quot;</span>
<span class="sd">            },</span>
<span class="sd">            {</span>
<span class="sd">                &#39;instId&#39;:&quot;BTC-USDT&quot;,</span>
<span class="sd">                &#39;ordId&#39;:&#39;480702885353881601&#39;</span>
<span class="sd">            }</span>
<span class="sd">        ]</span>
<span class="sd">        print(self.tradeApi.cancel_multiple_orders(data))</span>
<span class="sd">    def test_amend_order(self):</span>
<span class="sd">        print(self.tradeApi.amend_order(&quot;BTC-USDT&quot;,ordId=&quot;480706017781743616&quot;,newSz=&quot;0.03&quot;))</span>
<span class="sd">    def test_amend_order_batch(self):</span>
<span class="sd">        orderData = [</span>
<span class="sd">            {</span>
<span class="sd">                &#39;instId&#39;:&#39;ETH-USDT&#39;,</span>
<span class="sd">                &#39;ordId&#39;:&#39;480707205436669952&#39;,</span>
<span class="sd">                &#39;newSz&#39;:&#39;0.02&#39;</span>
<span class="sd">            },</span>
<span class="sd">            {</span>
<span class="sd">                &#39;instId&#39;:&#39;BTC-USDT&#39;,</span>
<span class="sd">                &#39;ordId&#39;:&#39;480707205436669953&#39;,</span>
<span class="sd">                &#39;newPx&#39;:&#39;3.0&#39;</span>
<span class="sd">            }</span>
<span class="sd">        ]</span>
<span class="sd">        print(self.tradeApi.amend_multiple_orders(orderData))</span>
<span class="sd">    def test_close_all_positions(self):</span>
<span class="sd">        print(self.tradeApi.close_positions(&quot;BTC-USDT&quot;,mgnMode=&quot;cross&quot;))</span>
<span class="sd">    def test_get_order_info(self):</span>
<span class="sd">        print(self.tradeApi.get_orders(&quot;ETH-USDT&quot;,&quot;480707205436669952&quot;))</span>
<span class="sd">    def test_get_order_pending(self):</span>
<span class="sd">        print(self.tradeApi.get_order_list(&quot;SPOT&quot;))</span>
<span class="sd">    def test_get_order_history(self):</span>
<span class="sd">        print(self.tradeApi.get_orders_history(&quot;SPOT&quot;))</span>
<span class="sd">    def test_get_order_histry_archive(self):</span>
<span class="sd">        print(self.tradeApi.orders_history_archive(&quot;SPOT&quot;))</span>
<span class="sd">    def test_get_fills(self):</span>
<span class="sd">        print(self.tradeApi.get_fills(&quot;SPOT&quot;))</span>
<span class="sd">    def test_get_fills_history(self):</span>
<span class="sd">        print(self.tradeApi.get_fills_history(&quot;SPOT&quot;))</span>
<span class="sd">    def test_get_order_algo_pending(self):</span>
<span class="sd">        print(self.tradeApi.order_algos_list(&#39;oco&#39;))</span>
<span class="sd">    def test_order_algo(self):</span>
<span class="sd">        print(self.tradeApi.place_algo_order(&#39;BTC-USDT-SWAP&#39;, &#39;cross&#39;, side=&#39;buy&#39;, ordType=&#39;trigger&#39;, posSide=&#39;long&#39;,</span>
<span class="sd">                                         sz=&#39;100&#39;, triggerPx=&#39;22000&#39;, triggerPxType	=&#39;index&#39;, orderPx=&#39;-1&#39;))</span>
<span class="sd">    def test_cancel_algos(self):</span>
<span class="sd">        params = [{</span>
<span class="sd">        &#39;algoId&#39;: &#39;485903392536264704&#39;,</span>
<span class="sd">        &#39;instId&#39;: &#39;BTC-USDT-SWAP&#39;</span>
<span class="sd">        }]</span>


<span class="sd">        print(self.tradeApi.cancel_algo_order(params))</span>
<span class="sd">        def test_cancel_adv_algos(self):</span>
<span class="sd">        params = [{</span>
<span class="sd">            &#39;algoId&#39;: &#39;485936482235191296&#39;,</span>
<span class="sd">            &#39;instId&#39;: &#39;BTC-USDT-SWAP&#39;</span>
<span class="sd">        }]</span>

<span class="sd">        print(self.tradeApi.cancel_advance_algos(params)))</span>
<span class="sd">        def test_orders_algo_pending(self):</span>
<span class="sd">        print(self.tradeApi.order_algos_list(ordType=&#39;iceberg&#39;))</span>
<span class="sd">        def test_algo_order_history(self):</span>
<span class="sd">        print(self.tradeApi.order_algos_history(algoId=&#39;485903392536264704&#39;,ordType=&#39;conditional&#39;))</span>
<span class="sd">        def test_get_easy_convert_list(self):</span>
<span class="sd">        print(self.tradeApi.get_easy_convert_currency_list())</span>
<span class="sd">        def test_easy_convert(self):</span>
<span class="sd">        print(self.tradeApi.easy_convert(fromCcy=[&#39;BTC&#39;],toCcy=&#39;OKB&#39;))</span>
<span class="sd">        def test_get_convert_history(self):</span>
<span class="sd">        print(self.tradeApi.get_easy_convert_history())</span>
<span class="sd">        def test_get_oneclick_repay_support_list(self):</span>
<span class="sd">        print(self.tradeApi.get_oneclick_repay_list(&#39;cross&#39;))</span>
<span class="sd">        def test_oneclick_repay(self):</span>
<span class="sd">        print(self.tradeApi.oneclick_repay([&#39;BTC&#39;],&#39;USDT&#39;))</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="c1">#485903392536264704</span>
    <span class="c1">#485936482235191296</span>
    <span class="c1"># def test_oneclick_repay_history(self):</span>
    <span class="c1">#     print(self.tradeApi.oneclick_repay_history())</span>
    <span class="c1"># def test_order_algo(self):</span>
    <span class="c1">#     print(self.tradeApi.place_algo_order(instId=&#39;BTC-USDT-SWAP&#39;, tdMode=&#39;cross&#39;, side=&#39;buy&#39;, ordType=&#39;conditional&#39;, \</span>
    <span class="c1">#         tpTriggerPx=&#39;15&#39;, tpOrdPx=&#39;18&#39;,sz=&#39;2&#39;))</span>

    <span class="c1"># 581628185981308928</span>
    <span class="c1"># def test_get_algo_order_details(self):</span>
    <span class="c1">#     print(self.tradeApi.get_algo_order_details(algoId=&#39;581628185981308928&#39;))</span>

    <span class="c1">#581628185981308928</span>
    <span class="c1"># def test_amend_algo_order(self):</span>
    <span class="c1">#     print(self.tradeApi.amend_algo_order(instId=&#39;BTC-USDT-SWAP&#39;, algoId=&#39;581628185981308928&#39;,newSz=&#39;3&#39;))</span>

    <span class="c1"># def test_get_order_history(self):</span>
    <span class="c1">#     print(self.tradeApi.get_orders_history(instType=&quot;SPOT&quot;,begin=&#39;1684857629313&#39;,end=&#39;1684857629313&#39;))</span>

    <span class="c1"># def test_get_order_histry_archive(self):</span>
    <span class="c1">#     print(self.tradeApi.get_orders_history_archive(instType=&quot;SPOT&quot;,begin=&#39;1684857629313&#39;,end=&#39;1684857629313&#39;))</span>
    <span class="c1"># def test_place_order(self):</span>
    <span class="c1">#     print(self.tradeApi.place_order(&quot;BTC-USDT&quot;, tdMode=&quot;cross&quot;, clOrdId=&quot;asCai1&quot;, side=&quot;buy&quot;, ordType=&quot;limit&quot;,</span>
    <span class="c1">#                                     sz=&quot;0.01&quot;, px=&quot;18000&quot;))</span>
    <span class="c1"># def test_batch_order(self):</span>
    <span class="c1">#     orderData = [{</span>
    <span class="c1">#         &quot;instId&quot;: &quot;ETH-USDT&quot;,</span>
    <span class="c1">#         &quot;tdMode&quot;: &quot;cross&quot;,</span>
    <span class="c1">#         &quot;clOrdId&quot;: &quot;b151121&quot;,</span>
    <span class="c1">#         &quot;side&quot;: &quot;buy&quot;,</span>
    <span class="c1">#         &quot;ordType&quot;: &quot;limit&quot;,</span>
    <span class="c1">#         &quot;px&quot;: &quot;2.15&quot;,</span>
    <span class="c1">#         &quot;sz&quot;: &quot;2&quot;</span>
    <span class="c1">#     },</span>
    <span class="c1">#         {</span>
    <span class="c1">#             &quot;instId&quot;: &quot;BTC-USDT&quot;,</span>
    <span class="c1">#             &quot;tdMode&quot;: &quot;cross&quot;,</span>
    <span class="c1">#             &quot;clOrdId&quot;: &quot;b152233&quot;,</span>
    <span class="c1">#             &quot;side&quot;: &quot;buy&quot;,</span>
    <span class="c1">#             &quot;ordType&quot;: &quot;limit&quot;,</span>
    <span class="c1">#             &quot;px&quot;: &quot;2.15&quot;,</span>
    <span class="c1">#             &quot;sz&quot;: &quot;2&quot;</span>
    <span class="c1">#         }]</span>
    <span class="c1">#     print(self.tradeApi.place_multiple_orders(orderData))</span>

        <span class="c1">#581616258865516544</span>
        <span class="c1">#581616258865516545</span>
    <span class="c1"># def test_amend_order(self):</span>
    <span class="c1">#     print(self.tradeApi.amend_order(&quot;BTC-USDT&quot;, ordId=&quot;581616258865516544&quot;, newSz=&quot;0.03&quot;))</span>
    <span class="c1"># def test_amend_order_batch(self):</span>
    <span class="c1">#     orderData = [</span>
    <span class="c1">#         {</span>
    <span class="c1">#             &#39;instId&#39;: &#39;ETH-USDT&#39;,</span>
    <span class="c1">#             &#39;ordId&#39;: &#39;581616258865516544&#39;,</span>
    <span class="c1">#             &#39;newSz&#39;: &#39;0.02&#39;</span>
    <span class="c1">#         },</span>
    <span class="c1">#         {</span>
    <span class="c1">#             &#39;instId&#39;: &#39;BTC-USDT&#39;,</span>
    <span class="c1">#             &#39;ordId&#39;: &#39;581616258865516545&#39;,</span>
    <span class="c1">#             &#39;newPx&#39;: &#39;3.0&#39;</span>
    <span class="c1">#         }</span>
    <span class="c1">#     ]</span>
    <span class="c1">#     print(self.tradeApi.amend_multiple_orders(orderData))</span>

    <span class="c1"># def test_order_algo(self):</span>
    <span class="c1">#</span>
    <span class="c1">#     print(self.tradeApi.place_algo_order(instId=&#39;BTC-USDT-SWAP&#39;, tdMode=&#39;cross&#39;, side=&#39;buy&#39;, ordType=&#39;conditional&#39;, \</span>
    <span class="c1">#                                          tpTriggerPx=&#39;15&#39;, tpOrdPx=&#39;18&#39;, sz=&#39;2&#39;,algoClOrdId=&#39;7678687&#39;,quickMgnType=&#39;manual&#39;))</span>

<div class="viewcode-block" id="TradeTest.test_order_algos_list">
<a class="viewcode-back" href="../../../pyokx.test.TradeTest.html#pyokx.test.TradeTest.TradeTest.test_order_algos_list">[docs]</a>
    <span class="k">def</span> <span class="nf">test_order_algos_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="nb">print</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tradeApi</span><span class="o">.</span><span class="n">order_algos_list</span><span class="p">(</span><span class="n">ordType</span><span class="o">=</span><span class="s1">&#39;conditional&#39;</span><span class="p">))</span></div>
</div>


    <span class="c1"># def test_order_algo(self):</span>
    <span class="c1">#     print(self.tradeApi.place_order(instId=&#39;BTC-USDT-SWAP&#39;, tdMode=&#39;cross&#39;, side=&#39;buy&#39;,px=&#39;121&#39;,sz=&#39;2&#39;,</span>
    <span class="c1">#                                     clOrdId=&#39;234234565535&#39;,ordType=&#39;market&#39;))</span>
    <span class="c1"># def test_close_all_positions(self):</span>
    <span class="c1">#     print(self.tradeApi.close_positions(instId=&quot;BTC-USDT-SWAP&quot;, mgnMode=&quot;cross&quot;,clOrdId=&#39;1213124&#39;))</span>
<span class="k">if</span> <span class="vm">__name__</span><span class="o">==</span><span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
    <span class="n">unittest</span><span class="o">.</span><span class="n">main</span><span class="p">()</span>
</pre></div>

           </div>
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2024, Ruben Fernandez Carbon.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>